'use strict';

const Service = require('egg').Service;

class CacheDataService extends Service {
  
  async create(data) {
    const { CacheData } = this.ctx.model
    const model = await CacheData.setData(data)
    return model._id
  }

  async getData(id) {
    const { CacheData } = this.ctx.model
    const model = await CacheData.getData(id)
    return model ? model.data : ''
  }
}

module.exports = CacheDataService;
